package com.web.article.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.web.article.service.IArticleService;
import com.web.common.dao.ArticleMapper;
import com.web.common.po.Article;

@Service("articleService")
public class ArticleServiceImpl implements IArticleService {
	
	@Resource
	private ArticleMapper articleMapper;
	
	@Override
	public List<Article> queryArticleList() {
		return articleMapper.queryAll();
	}

	@Override
	public boolean checkOwner(int articleId, int userId) {
		Long count = articleMapper.selectByUserAndArt(articleId, userId);
		return count.intValue() == 1;
	}

	@Override
	public Article getDetail(int articleId) {
		return articleMapper.selectByPrimaryKey(articleId);
	}

}
